﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoreFrame.Core.Orm;

namespace MarchEstate.Manager.BusinesEntity
{
    /// <summary>
    /// 水电表
    /// </summary>
    [Serializable]
    [Table(TableName = "WY_Meter", EntityType = EntityType.Table, IsGB = false)]
    public abstract class AbstractMeter : CoreFrame.Business.AbstractBusines
    {
        private string _meterid;//
        /// <summary>
        /// 
        /// </summary>
        [Column(FieldName = "MeterId", DataKey = true, IsSingleQuote = true, Match = "Custom:Guid", IsInsert = false)]
        public string MeterId
        {
            get { return _meterid; }
            set { _meterid = value; }
        }
        private int _metertype;//0,公摊；1，住宅；2，门面；3，其它
        /// <summary>
        /// 0,公摊；1，住宅；2，门面；3，其它
        /// </summary>
        [Column(FieldName = "MeterType", DataKey = false, IsSingleQuote = false, Match = "", IsInsert = true)]
        public int MeterType
        {
            get { return _metertype; }
            set { _metertype = value; }
        }
        private int _metertype2;//0，水表；1，电表；
        /// <summary>
        /// 0，水表；1，电表；
        /// </summary>
        [Column(FieldName = "MeterType2", DataKey = false, IsSingleQuote = false, Match = "", IsInsert = true)]
        public int MeterType2
        {
            get { return _metertype2; }
            set { _metertype2 = value; }
        }
        private string _areacode;//管理区域编号
        /// <summary>
        /// 管理区域编号
        /// </summary>
        [Column(FieldName = "AreaCode", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public string AreaCode
        {
            get { return _areacode; }
            set { _areacode = value; }
        }
        private string _buildingcode;//楼宇编号
        /// <summary>
        /// 楼宇编号
        /// </summary>
        [Column(FieldName = "BuildingCode", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public string BuildingCode
        {
            get { return _buildingcode; }
            set { _buildingcode = value; }
        }
        private string _ownerid;//
        /// <summary>
        /// 
        /// </summary>
        [Column(FieldName = "OwnerId", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public string OwnerId
        {
            get { return _ownerid; }
            set { _ownerid = value; }
        }
        private string _ownername;//
        /// <summary>
        /// 
        /// </summary>
        [Column(FieldName = "OwnerName", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public string OwnerName
        {
            get { return _ownername; }
            set { _ownername = value; }
        }

        private string _srccId;//
        /// <summary>
        /// 
        /// </summary>
        [Column(FieldName = "SrccId", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public string SrccId
        {
            get { return _srccId; }
            set { _srccId = value; }
        }

        private string _srccName;//
        /// <summary>
        /// 
        /// </summary>
        [Column(FieldName = "SrccName", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public string SrccName
        {
            get { return _srccName; }
            set { _srccName = value; }
        }

        private string _itemcode;//服务项目代码
        /// <summary>
        /// 服务项目代码
        /// </summary>
        [Column(FieldName = "ItemCode", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public string ItemCode
        {
            get { return _itemcode; }
            set { _itemcode = value; }
        }
        
        private DateTime _initialdate;//初始化日期
        /// <summary>
        /// 初始化日期
        /// </summary>
        [Column(FieldName = "InitialDate", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public DateTime InitialDate
        {
            get { return _initialdate; }
            set { _initialdate = value; }
        }

        private decimal _initMeterNum;//
        /// <summary>
        /// 上次数量
        /// </summary>
        [Column(FieldName = "InitMeterNum", DataKey = false, IsSingleQuote = false, Match = "", IsInsert = true)]
        public decimal InitMeterNum
        {
            get { return _initMeterNum; }
            set { _initMeterNum = value; }
        }

        private DateTime _lastmeterdate;//上次抄表时间
        /// <summary>
        /// 上次抄表时间
        /// </summary>
        [Column(FieldName = "LastMeterDate", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public DateTime LastMeterDate
        {
            get { return _lastmeterdate; }
            set { _lastmeterdate = value; }
        }

        private decimal _lastnum;//
        /// <summary>
        /// 上次数量
        /// </summary>
        [Column(FieldName = "LastNum", DataKey = false, IsSingleQuote = false, Match = "", IsInsert = true)]
        public decimal LastNum
        {
            get { return _lastnum; }
            set { _lastnum = value; }
        }

        private long _empid;//
        /// <summary>
        /// 
        /// </summary>
        [Column(FieldName = "EmpId", DataKey = false, IsSingleQuote = false, Match = "", IsInsert = true)]
        public long EmpId
        {
            get { return _empid; }
            set { _empid = value; }
        }
        private string _empname;//
        /// <summary>
        /// 
        /// </summary>
        [Column(FieldName = "EmpName", DataKey = false, IsSingleQuote = true, Match = "", IsInsert = true)]
        public string EmpName
        {
            get { return _empname; }
            set { _empname = value; }
        }

        private int _deleteflag;
        /// <summary>
        /// 删除标志 1删除
        /// </summary>
        [Column(FieldName = "DeleteFlag", DataKey = false, IsSingleQuote = false, Match = "", IsInsert = true)]
        public int DeleteFlag
        {
            get { return _deleteflag; }
            set { _deleteflag = value; }
        }

        public abstract bool Save();

        public abstract bool Delete(string _meterId);

        public abstract AbstractMeter GetMeter(string _meterId);

        /// <summary>
        /// 获取未生成表单的水电表
        /// </summary>
        /// <param name="_meterType">-1，全部；0,公摊；1，住宅；2，门面；3，其它</param>
        /// <param name="_meterType2">0，水表；1，电表；</param>
        /// <returns></returns>
        public abstract List<AbstractMeter> GetMeterList(int _meterType, int _meterType2);

        /// <summary>
        /// 获取未生成表单的水电表
        /// </summary>
        /// <param name="_meterType">-1，全部；0,公摊；1，住宅；2，门面；3，其它</param>
        /// <param name="_meterType2">0，水表；1，电表；</param>
        /// <returns></returns>
        public abstract List<AbstractMeter> GetMeterList(int _meterType, int _meterType2,PageInfo page);

        /// <summary>
        /// 获取未生成表单的水电表
        /// </summary>
        /// <param name="_meterType">-1，全部；0,公摊；1，住宅；2，门面；3，其它</param>
        /// <param name="_meterType2">0，水表；1，电表；</param>
        /// <param name="searchKey">查询用表，可以根据业主名称、房间号</param>
        /// <returns></returns>
        public abstract List<AbstractMeter> GetMeterList(int _meterType, int _meterType2,string searchKey, PageInfo page);

        public abstract List<AbstractMeter> GetAllMeterList(int _meterType, int _meterType2, PageInfo page);

        public abstract List<AbstractMeter> GetAllMeterList(string _SrccId, PageInfo page);

        /// <summary>
        /// 更新用表初始化读数
        /// </summary>
        /// <param name="_meterId"></param>
        /// <param name="_initNum"></param>
        /// <returns></returns>
        public abstract bool UpdateMeterInitNum(string _meterId,decimal _initNum);
    }
}
